﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SmartSpace.Silverlight
{
	public partial class PopupMessage : UserControl
	{

		public PopupMessage()
		{
			// 为初始化变量所必需
			InitializeComponent();
		}

        public void SetMessage(MessageType type, string message)
        {
            switch (type)
            {
                case MessageType.Information:
                    //m_imageInformation.Visibility = System.Windows.Visibility.Visible;
                    //m_imageError.Visibility = System.Windows.Visibility.Collapsed;
                    //m_imageWarning.Visibility = System.Windows.Visibility.Collapsed;
                    //m_border.Background = new SolidColorBrush(Color.FromArgb(255, 0, 200, 0));
                    //m_textBlockMessage.Foreground = new SolidColorBrush(Colors.White);
                    m_gridInfo.Visibility = System.Windows.Visibility.Visible;
                    m_gridError.Visibility = System.Windows.Visibility.Collapsed;
                    m_gridWarning.Visibility = System.Windows.Visibility.Collapsed;
                    m_textBlockInfoMessage.Text = message;
                    break;
                case MessageType.Warrning:
                    //m_imageInformation.Visibility = System.Windows.Visibility.Collapsed;
                    //m_imageError.Visibility = System.Windows.Visibility.Collapsed;
                    //m_imageWarning.Visibility = System.Windows.Visibility.Visible;
                    //m_border.Background = new SolidColorBrush(Color.FromArgb(255, 200, 200, 0));
                    //m_textBlockMessage.Foreground = new SolidColorBrush(Colors.Black);
                    m_gridInfo.Visibility = System.Windows.Visibility.Collapsed;
                    m_gridError.Visibility = System.Windows.Visibility.Collapsed;
                    m_gridWarning.Visibility = System.Windows.Visibility.Visible;
                    m_textBlockWarningMessage.Text = message;
                    break;
                case MessageType.Error:
                    //m_imageInformation.Visibility = System.Windows.Visibility.Collapsed;
                    //m_imageError.Visibility = System.Windows.Visibility.Visible;
                    //m_imageWarning.Visibility = System.Windows.Visibility.Collapsed;
                    //m_border.Background = new SolidColorBrush(Color.FromArgb(255, 200, 0, 0));
                    //m_textBlockMessage.Foreground = new SolidColorBrush(Colors.Black);
                    m_gridInfo.Visibility = System.Windows.Visibility.Collapsed;
                    m_gridError.Visibility = System.Windows.Visibility.Visible;
                    m_gridWarning.Visibility = System.Windows.Visibility.Collapsed;
                    m_textBlockErrorMessage.Text = message;
                    break;
            }
            //m_textBlockMessage.Text = message;
        }
	}
}